package com.sheep.spring.test;

import org.springframework.context.event.EventListener;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * @author wangze
 * @date 2021-01-18 15:27.
 **/
//也可以使用@EventListener监听事件
@Component
@Order(1)
public class CouponUserRegisterListener {
	@EventListener
	public void sendCoupon(UserRegisterEvent event) {
		System.out.println(Thread.currentThread().getName() + "-给用户" + event.getUsername() + "发送优惠券!");
	}

}
